/*
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
*/
package cmd

import (
	"github.com/rs/zerolog/log"
	"v3workshop/app"

	"github.com/spf13/cobra"
)

// mergeCmd represents the merge command
var mergeCmd = &cobra.Command{
	Use:   "merge",
	Short: "合并配置信息",
	Long: `
通过交互式多选框选择需要合并的mod包, 合并后的mod包会拷贝到目标路径
`,
	Run: func(cmd *cobra.Command, args []string) {
		m := app.NewManager()
		err := m.Merge(mergeOpt)
		if err != nil {
			log.Err(err).Msg("合并失败")
			return
		}
	},
}

var mergeOpt = new(app.MergeOption)

func init() {
	rootCmd.AddCommand(mergeCmd)

	mergeCmd.Flags().BoolVarP(&mergeOpt.Force, "force", "f", false, "强制合并")
}
